<template>
  <div class="create-top-wrap">
    <div class="page-title" v-text="title"></div>
    <el-breadcrumb class="stroke" separator="/">
      <el-breadcrumb-item>{{firstMenu}}</el-breadcrumb-item>
      <el-breadcrumb-item>{{secondMenu}}</el-breadcrumb-item>
    </el-breadcrumb>
    <el-button v-if="showAddBtn" plain class="add-btn" type="primary" size="small" @click="back">返回</el-button>
  </div>
</template>
<script lang="ts">
import Vue from 'vue';
import { Prop, Component, Emit } from 'vue-property-decorator';
@Component({})
export default class PageTop extends Vue {
  @Prop({ default: '一级菜单' })
  firstMenu!: string;
  @Prop({ default: '二级菜单' })
  secondMenu!: string;
  @Prop({ default: '页面标题' })
  title!: string;
  @Prop({ default: true })
  showAddBtn!: boolean;
  // methods
  back() {
    console.log(this.$router);

    this.$router.back();
  }
}
</script>
<style lang="less">
.create-top-wrap {
  display: flex;
  flex-direction: row;
  margin-bottom: 30px;
  .page-title {
    font-size: 24px;
    font-weight: 600;
    text-align: left;
    margin-right: 15px;
    align-content: baseline;
  }
  .stroke {
    display: flex;
    align-content: baseline;
    align-items: center;
  }
  .add-btn {
    margin-left: auto;
    width: 60px;
    align-self: flex-end;
  }
}
</style>
